package wiinf;

/**
 *
 * @author David Roos
 */
public class afdVerwijderen extends javax.swing.JPanel {
    private serverViewModel model;

    /**
     * Aanmaken nieuwe panel voor afdelingen verwijderen
     *
     * @param model De JFrame waar de panel in komt
     */
    public afdVerwijderen(serverViewModel model) {
        this.model = model;
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        CafdVerwijderen = new javax.swing.JComboBox();
        BafdVerwijderen = new javax.swing.JButton();

        setPreferredSize(new java.awt.Dimension(435, 303));

        model.setAfdelingBox(CafdVerwijderen);

        BafdVerwijderen.setText("Verwijder");
        BafdVerwijderen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BafdVerwijderenActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(223, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(CafdVerwijderen, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BafdVerwijderen))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(CafdVerwijderen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(97, 97, 97)
                .addComponent(BafdVerwijderen)
                .addContainerGap(138, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    /**
     * Actionlistener voor verwijder button
     *
     * @param evt action event
     */
    private void BafdVerwijderenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BafdVerwijderenActionPerformed
        // TODO add your handling code here:
        String naam = CafdVerwijderen.getSelectedItem().toString();
        model.server.deleteMap(naam);
}//GEN-LAST:event_BafdVerwijderenActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BafdVerwijderen;
    private javax.swing.JComboBox CafdVerwijderen;
    // End of variables declaration//GEN-END:variables

}
